package com.dstz.sys.controller;

import com.dstz.base.api.response.impl.ResultMsg;
import com.dstz.base.rest.ControllerTools;
import com.dstz.bpm.api.engine.action.cmd.FlowRequestParam;
import com.dstz.bpm.engine.action.cmd.DefaultInstanceActionCmd;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping({"/bpm/instance/ppcg"})
@Api(
        description = "流程实例服务接口"
)
public class BpmInstancePPCGController extends ControllerTools {

    @PostMapping("docailiao")
    public ResultMsg<String> doAction(@RequestBody FlowRequestParam flowParam, HttpServletRequest request) throws Exception {
        DefaultInstanceActionCmd instanceCmd = new DefaultInstanceActionCmd(flowParam);
        String actionName = instanceCmd.executeCmd();
        System.out.println("aaa");
        request.getParameter("mlbm");
        return this.getSuccessResult(instanceCmd.getInstanceId(), actionName + "成功");
    }
}
